# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gst-python
pkgver=1.18.5
pkgrel=3
pkgdesc="Multimedia graph framework - python bindings"
url="https://gstreamer.freedesktop.org/"
arch=(x86_64)
license=(LGPL)
depends=(python-gobject gst-plugins-base-libs)
makedepends=(git meson)
_commit=3d75c6b1eefc1a4190f58ac8d4610535f1acca3f  # tags/1.18.5^0
source=("git+https://gitlab.freedesktop.org/gstreamer/gst-python.git#commit=$_commit"
        0001-python-Avoid-treating-float-as-int.patch)
sha256sums=('SKIP'
            '62f301faddb4c713bd21b2da95daec9b73b903da168d7c9649550a0678a1ff77')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
  patch -Np3 -i ../0001-python-Avoid-treating-float-as-int.patch
}

build() {
  arch-meson $pkgname build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}
